package com.dynamic.mybatis.generator.vo;

import java.util.Collections;

public class GeneratorVo {

    private String outputDir;
    private String author;
    private boolean open;
    private String javaRootPath = "src.main.java";
    private String xmlRootPath = "src.main.resources";

    private String javaParent;

    private GeneratorDataSourceVo dataSource;

    private GeneratorStrategyVo strategy;


    public static GeneratorVo test() {
        GeneratorVo generatorVo = new GeneratorVo();
        String currentDir = System.getProperty("user.dir");
        generatorVo.setAuthor("xs");
        generatorVo.setOutputDir(currentDir);
        generatorVo.setJavaParent("com.dms.test");


        String url = "jdbc:mysql://localhost:3306/dms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT&tinyInt1isBit=false";
        generatorVo.setDataSource(new GeneratorDataSourceVo(url, "root", "root"));

        GeneratorStrategyVo strategyVo = new GeneratorStrategyVo();
        strategyVo.setTables(Collections.singletonList("test"));
        generatorVo.setStrategy(strategyVo);

        GeneratorFileVo entity = new GeneratorFileVo();
        entity.setPackageName("entity");
        entity.setFileName("%sEntity");
        entity.setDisable(Boolean.FALSE);
        strategyVo.setEntity(entity);

        GeneratorFileVo controller = new GeneratorFileVo();
        controller.setPackageName("controller");
        controller.setFileName("%sController");
        controller.setDisable(Boolean.FALSE);
        strategyVo.setController(controller);

        GeneratorFileVo service = new GeneratorFileVo();
        service.setPackageName("service");
        service.setFileName("%sService");
        service.setDisable(Boolean.FALSE);
        strategyVo.setService(service);

        GeneratorFileVo serviceImpl = new GeneratorFileVo();
        serviceImpl.setPackageName("service.impl");
        serviceImpl.setFileName("%sServiceImpl");
        serviceImpl.setDisable(Boolean.FALSE);
        strategyVo.setServiceImpl(serviceImpl);

        GeneratorFileVo mapper = new GeneratorFileVo();
        mapper.setPackageName("mapper");
        mapper.setFileName("%sMapper");
        mapper.setDisable(Boolean.FALSE);
        strategyVo.setMapper(mapper);

        GeneratorFileVo xml = new GeneratorFileVo();
        xml.setPackageName("mapper");
        xml.setFileName("%sMapper");
        xml.setDisable(Boolean.FALSE);
        strategyVo.setXml(xml);

        return generatorVo;
    }


    public String getOutputDir() {
        return outputDir;
    }

    public void setOutputDir(String outputDir) {
        this.outputDir = outputDir;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public boolean isOpen() {
        return open;
    }

    public void setOpen(boolean open) {
        this.open = open;
    }


    public String getJavaRootPath() {
        return javaRootPath;
    }

    public void setJavaRootPath(String javaRootPath) {
        this.javaRootPath = javaRootPath;
    }

    public String getXmlRootPath() {
        return xmlRootPath;
    }

    public void setXmlRootPath(String xmlRootPath) {
        this.xmlRootPath = xmlRootPath;
    }

    public String getJavaParent() {
        return javaParent;
    }

    public void setJavaParent(String javaParent) {
        this.javaParent = javaParent;
    }

    public GeneratorDataSourceVo getDataSource() {
        return dataSource;
    }

    public void setDataSource(GeneratorDataSourceVo dataSource) {
        this.dataSource = dataSource;
    }

    public GeneratorStrategyVo getStrategy() {
        return strategy;
    }

    public void setStrategy(GeneratorStrategyVo strategy) {
        this.strategy = strategy;
    }
}
